from typing import List

from fastapi import APIRouter

from dto.user_dto import UserDTO
from model.user_model import UserModel

user_router = APIRouter(prefix="/user", tags=["user"])


@user_router.get("/find_all", response_model=List[UserDTO])
async def find_all():
    users = await UserModel.all()
    return [UserDTO.model_validate(user, from_attributes=True) for user in users]
